A DIY Smart Home Guide by Robert Chin
Author:Robert Chin
Language: eng
Format: epub
Publisher: McGraw-Hill Education
Published: 2020-04-11T16:00:00+00:00
Setting Up the Software
The new code for this hands-on example consists of the Arduino code that was modified from the regular LED control example. The same Android program which is the basic wireless framework program version 1.1 is used here to control the piezo buzzer. Only the modifications to the previous Arduino LED control program will be discussed in this section.
The BuzzerPin variable holds the Arduino digital pin number that is connected to the positive terminal of the piezo buzzer.
int BuzzerPin = 7;
The Freq variable holds the frequency in hertz of the tone that the buzzer will produce when active and is set by default to 500 hertz.
int Freq = 500;
The BuzzerOn variable is true if the buzzer is currently producing a sound and false otherwise.
boolean BuzzerOn = false;
The SirenOn variable is true if the buzzer is currently in siren mode.
boolean SirenOn = false;
The SirenOffTime variable holds the time in milliseconds that the buzzer should be off during siren mode and has a default value of 1000 milliseconds or 1 second.
int SirenOffTime = 1000;
The SirenOnTime variable holds the time in milliseconds that the buzzer should be on during siren mode and has a default value of 1000 milliseconds or 1 second.
int SirenOnTime = 1000;
The SirenStartTime variable holds the start time of the siren on time and the siren off time. It is used to keep track of the duration of the siren on time and the siren off time.
unsigned long SirenStartTime = 0;
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Circuits | Digital Design |
Electric Machinery & Motors | Electronics |
Fiber Optics | Networks |
Superconductivity |
Whiskies Galore by Ian Buxton(41509)
Introduction to Aircraft Design (Cambridge Aerospace Series) by John P. Fielding(32876)
Small Unmanned Fixed-wing Aircraft Design by Andrew J. Keane Andras Sobester James P. Scanlan & András Sóbester & James P. Scanlan(32558)
Craft Beer for the Homebrewer by Michael Agnew(17917)
Turbulence by E. J. Noyes(7682)
The Complete Stick Figure Physics Tutorials by Allen Sarah(7120)
Kaplan MCAT General Chemistry Review by Kaplan(6568)
The Thirst by Nesbo Jo(6421)
Bad Blood by John Carreyrou(6260)
Modelling of Convective Heat and Mass Transfer in Rotating Flows by Igor V. Shevchuk(6216)
Learning SQL by Alan Beaulieu(6012)
Weapons of Math Destruction by Cathy O'Neil(5805)
Man-made Catastrophes and Risk Information Concealment by Dmitry Chernov & Didier Sornette(5626)
Digital Minimalism by Cal Newport;(5354)
Life 3.0: Being Human in the Age of Artificial Intelligence by Tegmark Max(5166)
iGen by Jean M. Twenge(5143)
Secrets of Antigravity Propulsion: Tesla, UFOs, and Classified Aerospace Technology by Ph.D. Paul A. Laviolette(4903)
Design of Trajectory Optimization Approach for Space Maneuver Vehicle Skip Entry Problems by Runqi Chai & Al Savvaris & Antonios Tsourdos & Senchun Chai(4833)
Electronic Devices & Circuits by Jacob Millman & Christos C. Halkias(4728)
